lobsterlayui.main(['index', 'layer', 'form', 'element', 'table'], {
    data: {

    },
    pageload: function (right) {
        console.log(right);
        var self = this;
        var currworkid = lobsterlayui.GetUrlParam('currworkid');
        $('#btnsycn').click(function () {
            if (!currworkid) {
                layer.msg('无效机构无法同步数据');
                return;
            }

            layer.confirm('确定要同步此机构数据？', { icon: 3, title: "提示" },
                function (index) {
                    layer.close(index);
                    var load = layer.msg('正在处理，请稍候', { icon: 16, time: 0, shade: [0.3, '#393D49'] });
                    self.syncdata(currworkid, function () {
                        layer.close(load);
                    })
                });
        })
    },
    syncdata(currworkid, callback) {

        lobsterlayui.GETAPI('tssyncdata.startsync', { currworkid: currworkid }).then(retdata => {
            $('#log1').text(retdata.log1);
            $('#log2').text(retdata.log2);
            $('#log3').text(retdata.log3);
            $('#log4').text(retdata.log4);
            callback && callback();
        })
    }
});